import App from './App'
// import request from '@/common/request/api.js'
import request from '@/common/request/api.js'
import userManager from '@/common/manager/user-manager.js'
import tool from '@/common/manager/tool.js'
import store from './store/index.js'
import consts from '@/common/manager/const.js'
import uviewPlus from '@/uni_modules/uview-plus'


import {
	mixinShare
} from './common/manager/mixin.js';
// #ifndef VUE3
import Vue from 'vue'

Vue.config.productionTip = false;
Vue.mixin(mixinShare);
const app = new Vue({
	...App,
})
app.mixin(mixinShare);
app.$mount()


// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import imgObject from './common/ossimg.js' // 全局图片

export function createApp() {
	const app = createSSRApp(App)
	 app.use(uviewPlus)
	app.config.globalProperties.$store = store
	app.config.globalProperties.$imageUrl = '';
	app.config.globalProperties.$userManager = userManager;
	app.config.globalProperties.$request = request;
	app.config.globalProperties.$tool = tool;
	app.config.globalProperties.$const = consts;

	app.mixin(mixinShare);
	for (let key in imgObject) {
		app.config.globalProperties[`$${key}`] = imgObject[key];
	}
	// 直接在 app.config.globalProperties 上挂载

	// plus.runtime.install('/static/__UNI__D54D707.wgt', {
	// 	force: false
	// }, () => {
	// 	uni.showModal({
	// 		title: '安装成功是否重启？',
	// 		success: res => {
	// 			if (res.confirm) {
	// 				//更新完重启app
	// 				plus.runtime.restart();
	// 			}
	// 		}
	// 	});
	// }, err => {
	// 	uni.hideLoading()
	// 	uni.showModal({
	// 		title: '更新失败',
	// 		content: err.message,
	// 		showCancel: false
	// 	})
	// })

	return {
		app
	}
}
// #endif